<?php
//编辑操作
//获取id
$id=$_GET['id'];
//导入数据库
require_once 'database.php';
//sql语句
$sql="select * from stu where id=$id";
//执行sql
$result=$conn->query($sql);
//得到具体的信息
$res=$result->fetch_assoc();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加学生信息</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" 
    integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
</head>
<body>
    <form action="go.php" style="padding:160px;line-height: 15px;">
        <div class="form-group" style="display:none;">
            <label>序号：</label>
            <input type="text"  name="id" value="<?php echo $res['id']?>"  class="form-control">
        </div>
        <div class="form-group">
            <label>账号：</label>
            <input type="text" name="username" value="<?php echo $res['username']?>"  class="form-control">
        </div>
        <div class="form-group">
            <label>密码：</label>
            <input type="text" name="password" value="<?php echo $res['password']?>" class="form-control">
        </div>
        <div class="form-group">
            <label>电话：</label>
            <input type="text" name="tel" value="<?php echo $res['tel']?>" class="form-control">
        </div>
        <div class="form-group">
            <label>地址：</label>
            <input type="text" name="address" value="<?php echo $res['address']?>" class="form-control">
        </div>
        <div class="form-group">
            <label>性别：</label>
            <input type="text" name="sex" value="<?php echo $res['sex']?>" class="form-control">
        </div>
        <button type="submit" class="btn btn-primary">编辑学生信息</button>
    </form>
</body>
</html>
